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

feat: add Opcode diffs (bounty: 300 OP 🔴) #6

Closed
mds1 opened this issue Jun 8, 2023 · 2 comments · Fixed by #12 or #19
Closed

feat: add Opcode diffs (bounty: 300 OP 🔴) #6

mds1 opened this issue Jun 8, 2023 · 2 comments · Fixed by #12 or #19
Assignees

Comments

@mds1
Copy link
Owner

mds1 commented Jun 8, 2023

This issue is eligible for a 300 OP bounty. Read CONTRIBUTING.md to learn how to qualify.

This is basically a version of https://www.evm.codes/ for each chain.

Each opcode should include all information shown by evm codes. Specifically:

  • Opcode number
  • Opcode name
  • Description
  • Minimum gas
  • Gas computation
  • Stack input AND descriptions for each stack input item
  • Stack output AND description for each stack output item
  • Error cases
  • Notes
  • References (i.e. links to the data sources)

The data for each chain should live in src/chains/[chainName]/vm/opcodes.ts. Alternatively, if that file gets too big, the path can be src/chains/[chainName]/vm/opcodes/[group].ts, where group matches the Ethereum execution-specs file names here. In the case where it's split up across multiple files in an opcodes folder, include an index.ts file that exports the final opcodes list.

The component to render the diff of opcodes should live in src/components/diff/DiffOpcodes.tsx. Two opcodes should be considered equal if every item in the above bulleted list matches, i.e. JSON.stringify(a) === JSON.stringify(b). If there any any differences, they should not be considered equal

To keep PRs small and easy to review, let's split this up into two PRs:

  • First PR adds the data for each chain. I'd suggest adding a few mainnet opcodes then opening a draft PR so we can align on the type definitions and make sure things look directionally correct before adding all opcodes.
  • Second one adds the DiffOpcodes.tsx component.

Suggested type to define in src/chains/types.ts:

type OpcodeParam = {
  name: string;
  description: string;
};

export type Opcode = {
  number: number;
  name: string;
  minGas: number;
  description: string;
  input: OpcodeParam[];
  output: OpcodeParam[];
  // Gas computation can get complex, so I'm not sure of the best way to
  // represent this. If it's hard, this can be left out for now and we can
  // create a separate issue to track.
  gasComputation: TODO;
  errorCases: string[];
  notes: string[];
  references: string[];
};

// This type already exists and we're adding the `opcodes` field.
export type Chain = {
  metadata: Metadata;
  precompiles: (Precompile | Predeploy)[];
  opcodes: Opcode[];
};
@mds1 mds1 changed the title feat: add Opcode diffs feat: add Opcode diffs (bounty: 300 OP 🔴) Jun 9, 2023
@leovct
Copy link
Contributor

leovct commented Jun 10, 2023

hi @mds1, happy to start working on the PR to add the first mainnet opcodes :)

@mds1
Copy link
Owner Author

mds1 commented Jun 10, 2023

Awesome thanks @leovct!

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