-
Notifications
You must be signed in to change notification settings - Fork 7
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
Beds 526/Raw DB sdk #947
base: staging
Are you sure you want to change the base?
Beds 526/Raw DB sdk #947
Conversation
e0b6374
to
1fdf888
Compare
86d3841
to
cd8bbcb
Compare
c0ec2bc
to
2657fae
Compare
if err != nil { | ||
t.Fatal(err) | ||
} | ||
ctx := context.Background() |
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.
ctx := context.Background() | |
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) | |
defer cancel() |
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.
It's databasetest/bigtable.go
is the sim bigtable but controlled through go. I don't really see the need for the context with timeout in that case.
} | ||
|
||
func (s *SenderFromDBSigner) ChainID() *big.Int { | ||
panic("can't sign with SenderFromDBSigner") |
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.
panic("can't sign with SenderFromDBSigner") | |
panic("can't sign with SenderFromDBSigner: ChainID method not supported") |
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.
I prefer to modify as little as possible when we "copy" code from somewhere.
The reasoning behind that is: let say in the future the source is update, we propagate this update, but we loose the local change.
So we may introduce a behavior that is prone to change.
panic("can't sign with SenderFromDBSigner") | ||
} | ||
func (s *SenderFromDBSigner) Hash(tx *types.Transaction) common.Hash { | ||
panic("can't sign with SenderFromDBSigner") |
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.
panic("can't sign with SenderFromDBSigner") | |
panic("can't sign with SenderFromDBSigner: Hash method not supported") |
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.
same
panic("can't sign with SenderFromDBSigner") | ||
} | ||
func (s *SenderFromDBSigner) SignatureValues(tx *types.Transaction, sig []byte) (R, S, V *big.Int, err error) { | ||
panic("can't sign with SenderFromDBSigner") |
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.
panic("can't sign with SenderFromDBSigner") | |
panic("can't sign with SenderFromDBSigner: SignatureValues method not supported") |
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.
same
// copy of senderFromServer | ||
// https://github.com/ethereum/go-ethereum/blob/v1.14.11/ethclient/signer.go#L30 | ||
type SenderFromDBSigner struct { | ||
addr common.Address |
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.
addr common.Address | |
Address common.Address |
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.
same
// https://github.com/ethereum/go-ethereum/blob/v1.14.11/ethclient/signer.go#L30 | ||
type SenderFromDBSigner struct { | ||
addr common.Address | ||
Blockhash common.Hash |
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.
Blockhash common.Hash | |
BlockHash common.Hash |
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.
same
Input string | ||
Output string | ||
Error string | ||
RevertReason string // todo have a look at this, it could improve revert message |
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.
RevertReason string // todo have a look at this, it could improve revert message | |
RevertReason string // todo have a look at this, it could improve revert message |
Is this comment still needed or can we remove it?
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.
Yes it for future use. That field provide more context but is not present everywhere. If we change the indexer I want us to think about parsing this field.
@Tangui-Bitfly Can you update the PR title to align with the template and to reflect the issue being addressed? Thanks! ^^ |
} | ||
// TODO make warning not found in cache | ||
block, err := c.store.ReadBlockByNumber(chainID, number) | ||
if block != nil { |
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 block != nil { | |
if err != nil { | |
return nil, fmt.Errorf("block not found in cache: error %v", err) | |
} | |
if block != nil { |
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.
No you missed the point here. We don't want to handle the err, it's a cache layer, a passthrough. But we want to save the block in cache if it's not nil.
go c.unCacheBlockAfter(key, "", oneBlockTTL) | ||
return v.(*FullBlockData), nil | ||
} | ||
// TODO make warning not found in cache |
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.
// TODO make warning not found in cache |
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.
No once we have a proper logger I want to log something here
block int64 | ||
}{ | ||
{ | ||
name: "test block", |
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.
The test names could be more descriptive - eg this one we can consider renaming to "Test Block Retrieval" or something similar for better clarity
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.
I prefer to keep it simple.
TestBigTableClient.test_block
provide the same amount of info than TestBigTableClient.Test_Block_Retrieval
Or we could rename the test itself rather than the case.
But TestBigTableClient
is describing what the test does, so I don't really how to improve it
2657fae
to
293622e
Compare
db2/BigTableEthRaw: add chainID db2/BigTableEthRaw: handle index for get uncle db2/BigTableEthRaw: fix with empty tx db2/BigTableEthRaw: add real condition test db2/BigTableEthRaw: add WithFallback db2/BigTableEthRaw: fallback for unsupported method db2: add cache to raw store (#966) db2: better cache + client + update store bigtable + clean up db2/raw: add EthParse
da0ce9c
to
d18c11a
Compare
I'm not sure by what you want me to replace it with. There is no rule on PR name. |
@Tangui-Bitfly Could you please update the PR title to better reflect what this PR is implementing? If you're unsure, you can refer to the doc created by @peterbitfly or other open PRs in this repo eg. PR #1144 for guidance on how to name it. Thanks! |
There is no guidance about PR name. Moreover PR are mostly irrelevant now because we don't have merge commit. |
I’m not quite sure I understand how PRs are irrelevant now. A good PR title should clearly reflect the changes whether it’s a new feature or a fix. Right now the title doesn’t quite capture what this PR implements or addresses so it would be helpful if you could update it. This will make things clearer for everyone. Here are a couple of articles that can help guide you: Let me know if you have any questions, thanks! |
db2.BigTableEthRaw
which only purpose is reading from the raw bigtable storedb2.BigTableEthRaw
is ahttp.RoundTriper
, this allow the caller to use when creating a newethclient.Client
db2.RawStore
to handle all interaction with bigtable satore. There are some duplications here, the aim of this pr is not to refactor everything, it's just to provide an easy to use way of retrieving eth data from bigtable