Skip to content

Commit befd982

Browse files
dartdart26eudelins-zama
authored andcommitted
chore(coprocessor): support for extraData in InputVerification and MultichainAcl
Related to a405734 Resolves zama-ai/fhevm-internal#270
1 parent fc3bd70 commit befd982

15 files changed

+73
-24
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE verify_proofs
2+
ADD COLUMN IF NOT EXISTS extra_data BYTEA NOT NULL DEFAULT ''::BYTEA;
Lines changed: 9 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coprocessor/fhevm-engine/gw-listener/contracts/InputVerification.sol

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ contract InputVerification {
99
uint256 indexed contractChainId,
1010
address contractAddress,
1111
address userAddress,
12-
bytes ciphertextWithZKProof
12+
bytes ciphertextWithZKProof,
13+
bytes extraData
1314
);
1415

1516
uint256 zkProofIdCounter = 0;
@@ -18,7 +19,8 @@ contract InputVerification {
1819
uint256 contractChainId,
1920
address contractAddress,
2021
address userAddress,
21-
bytes calldata ciphertextWithZKProof
22+
bytes calldata ciphertextWithZKProof,
23+
bytes calldata extraData
2224
) public {
2325
uint256 zkProofId = zkProofIdCounter;
2426
zkProofIdCounter += 1;
@@ -27,7 +29,8 @@ contract InputVerification {
2729
contractChainId,
2830
contractAddress,
2931
userAddress,
30-
ciphertextWithZKProof
32+
ciphertextWithZKProof,
33+
extraData
3134
);
3235
}
3336
}

coprocessor/fhevm-engine/gw-listener/src/gw_listener.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,17 @@ impl<P: Provider<Ethereum> + Clone + 'static> GatewayListener<P> {
134134
// TODO: check if we can avoid the cast from u256 to i64
135135
sqlx::query!(
136136
"WITH ins AS (
137-
INSERT INTO verify_proofs (zk_proof_id, chain_id, contract_address, user_address, input)
138-
VALUES ($1, $2, $3, $4, $5)
137+
INSERT INTO verify_proofs (zk_proof_id, chain_id, contract_address, user_address, input, extra_data)
138+
VALUES ($1, $2, $3, $4, $5, $6)
139139
ON CONFLICT(zk_proof_id) DO NOTHING
140140
)
141-
SELECT pg_notify($6, '')",
141+
SELECT pg_notify($7, '')",
142142
request.zkProofId.to::<i64>(),
143143
request.contractChainId.to::<i32>(),
144144
request.contractAddress.to_string(),
145145
request.userAddress.to_string(),
146146
Some(request.ciphertextWithZKProof.as_ref()),
147+
request.extraData.as_ref(),
147148
self.conf.verify_proof_req_db_channel
148149
)
149150
.execute(db_pool)

coprocessor/fhevm-engine/gw-listener/tests/gw_listener_tests.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ async fn verify_proof_request_inserted_into_db() -> anyhow::Result<()> {
9494
contract_address,
9595
user_address,
9696
(&[1u8; 2048]).into(),
97+
Vec::<u8>::new().into(),
9798
)
9899
.into_transaction_request();
99100
let pending_txn = provider.send_transaction(txn_req).await?;
@@ -102,7 +103,7 @@ async fn verify_proof_request_inserted_into_db() -> anyhow::Result<()> {
102103

103104
loop {
104105
let rows = sqlx::query!(
105-
"SELECT zk_proof_id, chain_id, contract_address, user_address, input
106+
"SELECT zk_proof_id, chain_id, contract_address, user_address, input, extra_data
106107
FROM verify_proofs",
107108
)
108109
.fetch_all(&env.db_pool)
@@ -113,6 +114,7 @@ async fn verify_proof_request_inserted_into_db() -> anyhow::Result<()> {
113114
assert_eq!(row.contract_address, contract_address.to_string());
114115
assert_eq!(row.user_address, user_address.to_string());
115116
assert_eq!(row.input, Some([1u8; 2048].to_vec()));
117+
assert!(row.extra_data.is_empty());
116118
break;
117119
}
118120
sleep(Duration::from_millis(500)).await;

coprocessor/fhevm-engine/transaction-sender/.sqlx/query-048212909e0bbe46633e404235d2c5cffb5284903adb757b4fda59b7fbe81d57.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coprocessor/fhevm-engine/transaction-sender/.sqlx/query-b5b633e5812b7396037e2ab0a1db9a1d753b8650ed3367681ba30ed426799502.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coprocessor/fhevm-engine/transaction-sender/.sqlx/query-be2b163e885ff2e4df27ae07c51f8c304f534b50565504a96bd63ce63a6179d7.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)