fix: correctly trim implementation address #1261
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There's a bug in the logic of
getImplementationAddress
, where we call viem'strim
over the ERC-1967 storage slot's value. This results in two issues:0x00
instead ofaddress(0)
.Both of these could cause issues if the caller wants to use them as a viem
Address
type, because they will not be of the full length.To fix this, we can manually trim out the first 12 bytes of the response, because if the response exists, it should always be 32 bytes in total.
Also updates
package.json
to not have verbose logging on by default, just for warnings. The number of files linted by prettier would fill up the entire scrollback buffer in my builtin terminal.Pull Request Checklist
yarn test
)site
folder, and guidelines for updating/adding docs can be found in the contribution guide)feat!: breaking change
)yarn lint:check
) and fix any issues? (yarn lint:write
)PR-Codex overview
This PR focuses on improving the linting command in
package.json
, refining thetoSmartContractAccount
function insmartContractAccount.ts
, and adding a new test case inclient.test.ts
to validate the implementation address retrieval process.Detailed summary
lint:write
command inpackage.json
to use--loglevel warn
.toSmartContractAccount
function to return the last 20 bytes ofstorage
prefixed with0x
.client.test.ts
to verify the correct retrieval of the implementation address before and after deployment.