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

[WIP]Updated VM With Contracts #1598

Draft
wants to merge 27 commits into
base: main
Choose a base branch
from
Draft

[WIP]Updated VM With Contracts #1598

wants to merge 27 commits into from

Conversation

samliok
Copy link
Contributor

@samliok samliok commented Sep 27, 2024

TODOS

  • Implement Call Action
  • Implement Deploy Action
  • Set up storage for contracts
  • prefetching statekeys on Call action
  • Integrate into VM
  • End to end testing

@samliok samliok self-assigned this Sep 27, 2024
@samliok samliok marked this pull request as draft September 27, 2024 19:46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this belongs here

@richardpringle richardpringle changed the title [WIP} Updated VM With Contracts [WIP]Updated VM With Contracts Oct 8, 2024
Copy link
Contributor

@richardpringle richardpringle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bunch of comments... not all of them need to be addressed by any stretch.

I think there are definitely a few things that we can improve over the other existing examples.


// Specify all statekeys Execute can touch
func (c *Call) StateKeys(actor codec.Address, actionID ids.ID) state.Keys {
return state.Keys{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this is a TODO?

This needs to be part of the Call struct, I'm pretty sure.

examples/updated-vm-with-contracts/actions/call.go Outdated Show resolved Hide resolved
Comment on lines +39 to +47
// prefix's all contract related keys
contractPrefix = 0x4
contractBytePrefix = 0x5
// prefix's all contract state keys
contractStatePrefix = 0x0
// contract bytes prefixc, prefix's ids -> contract bytes
// contract state prefix, prefix's ids -> contract state
// contract ID prefix[ contractPrefix -> contractIDPrefix ]
contractIDPrefix = 0x2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any thoughts on putting this stuff in the runtime package?

Comment on lines +191 to +201
func HeightKey() (k []byte) {
return heightKey
}

func TimestampKey() (k []byte) {
return timestampKey
}

func FeeKey() (k []byte) {
return feeKey
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These variables aren't used anywhere else, any reason not to inline them?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems weird that this is part of the vm package

}
reply.Amount = balance
return err
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole thing needs to be spun out into an rpc package


// When registering new auth, ALWAYS make sure to append at the end.
AuthParser.Register(&auth.ED25519{}, auth.UnmarshalED25519),
AuthParser.Register(&auth.SECP256R1{}, auth.UnmarshalSECP256R1),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we use two different curves?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants