Skip to content
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

Smart Contract's bytecode is gossiped every time balance or storage is updated. #1396

Open
morph-dev opened this issue Aug 24, 2024 · 3 comments
Labels
portal-bridge Portal bridge state network Issue related to portal state network
Milestone

Comments

@morph-dev
Copy link
Collaborator

Currently, we will try to gossip Smart Contract's code even if it is not modified.
If contract's balance or storage was updated, entire AccountState (and leaf in the account trie) will be updated as well.

The following code would then gossip bytecode as well:

if account.code_hash != keccak256([]) {
// gossip contract bytecode
let code = state.database.code_by_hash_ref(account.code_hash)?;
self.gossip_contract_bytecode(
address_hash,
&account_proof,
block_tuple.header.header.hash(),
account.code_hash,
code,
)
.await?;
}

I'm not sure if there is easy way for this to be fixed.

@morph-dev morph-dev added state network Issue related to portal state network portal-bridge Portal bridge labels Aug 24, 2024
@morph-dev morph-dev added this to the Devcon 2024 milestone Aug 24, 2024
@KolbyML
Copy link
Member

KolbyML commented Aug 26, 2024

I don't think this is a milestone for devcon 2024

@KolbyML
Copy link
Member

KolbyML commented Aug 26, 2024

Just in case someone wanted to work on this, #1337 this PR should be merged first as it would invalidate the work from this PR.

I think in the grand scheme of things there is a lot that should be done before this issue though

@morph-dev
Copy link
Collaborator Author

morph-dev commented Aug 26, 2024

I don't think this is a milestone for devcon 2024

While I think it's not critical for the devcon and there are other important issue, I think we should have this if we want to gossip head blocks (because there will be a lot of contracts that are touched at every block).

100% there is just a lot to do before we reach that, lot being relative

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
portal-bridge Portal bridge state network Issue related to portal state network
Projects
None yet
Development

No branches or pull requests

2 participants