-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Shared sequencer integration for fuel-core 0.40.0
#2451
base: release/v0.40.1
Are you sure you want to change the base?
Conversation
|
||
let block = self.tendermint()?.block(height).await?; | ||
|
||
for item in block.block.data.iter().skip(1) { |
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.
Why do we skip one ?
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.
@Dentosal Added it, so I don't know=) I will remove this function for now, since it is not used
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.
Thank you for the comments :)
pub tx_bytes: String, | ||
} | ||
|
||
pub async fn estimate_transaction( |
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.
do we want any retry logic here? can be a follow up PR
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 current implementation doesn't care if we are not able to submit the blob. We just try to do that, and if not, then it's okay.
In the future(follow-up issue), we need to worry about it and guarantee that all blobs are posted and there are no gaps.
|
||
impl Client { | ||
/// Create a new shared sequencer client from config. | ||
pub async fn new(endpoints: Endpoints, topic: [u8; 32]) -> anyhow::Result<Self> { |
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 think it should also accept the expected client_id so that we don't misconfigure with the wrong network/chain.
on L68 we can perform the check
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.
What is the client_id
? Do you mean chain_id
? I want to keep the current implementation as simple, as possible.
Plus, if the RPC is malicious, it can lie about its chain_id
.make_payload(timeout_height, fee, signer, account, order, topic, data) | ||
.await?; | ||
|
||
let r = self.tendermint()?.broadcast_tx_sync(payload).await?; |
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.
maybe we should have some retry logic here?
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 same logic here #2451 (comment)
|
||
/// Sign a blob of data | ||
pub async fn sign(&self, data: &[u8]) -> anyhow::Result<Signature> { | ||
self.sign_message(Message::new(data)).await |
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.
perhaps we should add a check here for the length of the message?
we should return an error if the payload is of length 0, it's behaviour is undefined in the specs of the elliptic curves afaiu
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 Message
performs hashing inside, so it will be just empty hash.
|
||
let k256_public_key = | ||
k256::PublicKey::from_public_key_der(cached_public_key_bytes)?; | ||
Ok(Some(k256_public_key.into())) |
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.
q: why don't we just set the public key into the enum variant instead of its raw form? we won't have to recalculate it when verifying_key()
is called every time.
as i understand the code, make_payload()
is leading to this function being called repeatedly
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 is more question to @Dentosal =) Performance is not critical in make_payload
because we call this function twice each 12 seconds
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.
first pass :)
Description
This PR duplicates #1922, but on top of the
fuel-core 0.40.0
.Since the current
master
is not ready to be released, but we want this feature in the testnet, we will create a minor release with added off-chain logic that posts data to the SS.All changes are the same as in the original PR, except
reqwest
is bumped to0.12
, because it has a fix important for SS.Before requesting review