Skip to content

eth-verify recovery param #670

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

Merged
merged 4 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 43 additions & 43 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ workflows:
jobs:
contract_sg721_base:
docker:
- image: rust:1.73.0
- image: rust:1.74.1
working_directory: ~/project/contracts/collections/sg721-base
steps:
- checkout:
Expand All @@ -41,7 +41,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-sg721-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
- cargocache-sg721-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
Expand All @@ -63,11 +63,11 @@ jobs:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-sg721-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
key: cargocache-sg721-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}

contract_sg721_nt:
docker:
- image: rust:1.73.0
- image: rust:1.74.1
working_directory: ~/project/contracts/collections/sg721-nt
steps:
- checkout:
Expand All @@ -77,7 +77,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-sg721-nt-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
- cargocache-sg721-nt-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
Expand All @@ -99,11 +99,11 @@ jobs:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-sg721-nt-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
key: cargocache-sg721-nt-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}

contract_base_factory:
docker:
- image: rust:1.73.0
- image: rust:1.74.1
working_directory: ~/project/contracts/factories/base-factory
steps:
- checkout:
Expand All @@ -113,7 +113,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-base-factory-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
- cargocache-base-factory-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
Expand All @@ -135,11 +135,11 @@ jobs:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-base-factory-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
key: cargocache-base-factory-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}

contract_base_minter:
docker:
- image: rust:1.73.0
- image: rust:1.74.1
working_directory: ~/project/contracts/minters/base-minter
steps:
- checkout:
Expand All @@ -149,7 +149,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-base-minter-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
- cargocache-base-minter-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
Expand All @@ -171,11 +171,11 @@ jobs:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-base-minter-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
key: cargocache-base-minter-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}

contract_vending_factory:
docker:
- image: rust:1.73.0
- image: rust:1.74.1
working_directory: ~/project/contracts/factories/vending-factory
steps:
- checkout:
Expand All @@ -185,7 +185,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-vending-factory-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
- cargocache-vending-factory-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
Expand All @@ -207,11 +207,11 @@ jobs:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-vending-factory-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
key: cargocache-vending-factory-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}

contract_vending_minter:
docker:
- image: rust:1.73.0
- image: rust:1.74.1
working_directory: ~/project/contracts/minters/vending-minter
steps:
- checkout:
Expand All @@ -221,7 +221,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-vending-minter-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
- cargocache-vending-minter-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
Expand All @@ -243,11 +243,11 @@ jobs:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-vending-minter-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
key: cargocache-vending-minter-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}

contract_open_edition_factory:
docker:
- image: rust:1.73.0
- image: rust:1.74.1
working_directory: ~/project/contracts/factories/open-edition-factory
steps:
- checkout:
Expand All @@ -257,7 +257,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-open-edition-factory-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
- cargocache-open-edition-factory-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
Expand All @@ -279,11 +279,11 @@ jobs:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-open-edition-factory-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
key: cargocache-open-edition-factory-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}

contract_open_edition_minter:
docker:
- image: rust:1.73.0
- image: rust:1.74.1
working_directory: ~/project/contracts/minters/open-edition-minter
steps:
- checkout:
Expand All @@ -293,7 +293,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-open-edition-minter-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
- cargocache-open-edition-minter-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
Expand All @@ -315,11 +315,11 @@ jobs:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-open-edition-minter-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
key: cargocache-open-edition-minter-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}

contract_whitelist:
docker:
- image: rust:1.73.0
- image: rust:1.74.1
working_directory: ~/project/contracts/whitelists/whitelist
steps:
- checkout:
Expand All @@ -329,7 +329,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-whitelist-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
- cargocache-whitelist-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
Expand All @@ -351,10 +351,10 @@ jobs:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-whitelist-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
key: cargocache-whitelist-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}
test-suite:
docker:
- image: rust:1.73.0
- image: rust:1.74.1
working_directory: ~/project/test-suite
steps:
- checkout:
Expand All @@ -364,7 +364,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-test-suite-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
- cargocache-test-suite-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
Expand All @@ -374,11 +374,11 @@ jobs:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-test-suite-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
key: cargocache-test-suite-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}

package_sg_std:
docker:
- image: rust:1.73.0
- image: rust:1.74.1
working_directory: ~/project/package/sg-std
steps:
- checkout:
Expand All @@ -388,7 +388,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-sg-std-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
- cargocache-sg-std-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
Expand All @@ -398,11 +398,11 @@ jobs:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-sg-std-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
key: cargocache-sg-std-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}

package_sg_utils:
docker:
- image: rust:1.73.0
- image: rust:1.74.1
working_directory: ~/project/package/sg-utils
steps:
- checkout:
Expand All @@ -412,7 +412,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-sg-utils-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
- cargocache-sg-utils-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
Expand All @@ -422,11 +422,11 @@ jobs:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-sg-utils-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
key: cargocache-sg-utils-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}

sg-eth-airdrop:
docker:
- image: rust:1.73.0
- image: rust:1.74.1
working_directory: ~/project/contracts/sg-eth-airdrop
steps:
- checkout:
Expand All @@ -436,7 +436,7 @@ jobs:
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-sg-eth-airdrop-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
- cargocache-sg-eth-airdrop-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Unit Tests
environment:
Expand All @@ -458,19 +458,19 @@ jobs:
paths:
- /usr/local/cargo/registry
- target
key: cargocache-sg-eth-airdrop-rust:1.73.0-{{ checksum "~/project/Cargo.lock" }}
key: cargocache-sg-eth-airdrop-rust:1.74.1-{{ checksum "~/project/Cargo.lock" }}

lint:
docker:
- image: rust:1.73.0
- image: rust:1.74.1
steps:
- checkout
- run:
name: Version information
command: rustc --version; cargo --version; rustup --version; rustup target list --installed
- restore_cache:
keys:
- cargocache-v2-lint-rust:1.73.0-{{ checksum "Cargo.lock" }}
- cargocache-v2-lint-rust:1.74.1-{{ checksum "Cargo.lock" }}
- run:
name: Add rustfmt component
command: rustup component add rustfmt
Expand All @@ -489,15 +489,15 @@ jobs:
- target/debug/.fingerprint
- target/debug/build
- target/debug/deps
key: cargocache-v2-lint-rust:1.73.0-{{ checksum "Cargo.lock" }}
key: cargocache-v2-lint-rust:1.74.1-{{ checksum "Cargo.lock" }}

# This runs one time on the top level to ensure all contracts compile properly into wasm.
# We don't run the wasm build per contract build, and then reuse a lot of the same dependencies, so this speeds up CI time
# for all the other tests.
# We also sanity-check the resultant wasm files.
wasm-build:
docker:
- image: rust:1.73.0
- image: rust:1.74.1
steps:
- checkout:
path: ~/project
Expand Down
8 changes: 8 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@ pull_request_rules:
backport:
branches:
- release/v2.x
- name: backport to v3
conditions:
- base=main
- label=backport/3.x
actions:
backport:
branches:
- release/v3.x
1 change: 1 addition & 0 deletions packages/ethereum-verify/src/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use sha3::{Digest, Keccak256};
/// [EIP-155]: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-155.md
pub fn get_recovery_param(v: u8) -> StdResult<u8> {
match v {
0 | 1 => Ok(v),
27 => Ok(0),
28 => Ok(1),
_ => Err(StdError::generic_err("Values of v other than 27 and 28 not supported. Replay protection (EIP-155) cannot be used here."))
Expand Down