-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(sidecar-extensibility): detect upgradeable contracts #237
base: master
Are you sure you want to change the base?
Conversation
2b3b4c7
to
c05e33b
Compare
c05e33b
to
d91781e
Compare
pkg/fetcher/fetcher.go
Outdated
|
||
func (f *Fetcher) GetContractStorageSlot(ctx context.Context, contractAddress string, blockNumber uint64) (string, error) { | ||
stringBlock := "" | ||
if blockNumber == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we process everything block by block, we want this to explicitly be the block height we're processing, i.e. the provided blockHeight
argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's 0, we should return an error
t.Fatal(err) | ||
} | ||
|
||
baseUrl := "https://winter-white-crater.ethereum-holesky.quiknode.pro/1b1d75c4ada73b7ad98e1488880649d4ea637733/" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably make this a node that isnt one of our paid quiknode endpoints
|
||
t.Run("Test indexing contract upgrades", func(t *testing.T) { | ||
// Create a contract | ||
_, found, err := contractStore.FindOrCreateContract(contract.ContractAddress, contract.ContractAbi, contract.Verified, contract.BytecodeHash, contract.MatchingContractAddress, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an okay way to do this. IMO I would create the models directly in the db with grm.Model().Create()
, main reason being it saves you (and anyone else) from needing to update this later if FindOrCreateContract
changes for some reason.
{ | ||
Name: "implementation", | ||
Type: "address", | ||
Value: common.HexToAddress("0x789"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would recommend using a valid address here just to make it as complete as possible
res = grm.Raw(`select count(*) from proxy_contracts where contract_address=@contractAddress`, sql.Named("contractAddress", contractAddress)).Scan(&proxyContractCount) | ||
assert.Nil(t, res.Error) | ||
assert.Equal(t, 2, proxyContractCount) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably need a test as well to cover getting the address from the storage slot
Hi seri - great PR! Can we have a description please? |
@serichoi65 I'll let you fill in the PR body with implementation specifics. @non-fungible-nelson I added a link to the related github issue this addresses |
[WIP with PR description]
This PR includes two features:
References: #223