feat: protecting fee payer against griefing#7689
Conversation
62128a4 to
6d17618
Compare
239ea3b to
888f71b
Compare
6d17618 to
7e4bd80
Compare
888f71b to
b9d2ce8
Compare
7e4bd80 to
df09327
Compare
b9d2ce8 to
d3e771a
Compare
df09327 to
732842f
Compare
d3e771a to
633db8a
Compare
Benchmark resultsMetrics with a significant change:
Detailed resultsAll benchmarks are run on txs on the This benchmark source data is available in JSON format on S3 here. Proof generationEach column represents the number of threads used in proof generation.
L2 block published to L1Each column represents the number of txs on an L2 block published to L1.
L2 chain processingEach column represents the number of blocks on the L2 chain where each block has 8 txs.
Circuits statsStats on running time and I/O sizes collected for every kernel circuit run across all benchmarks.
Stats on running time collected for app circuits
AVM SimulationTime to simulate various public functions in the AVM.
Public DB AccessTime to access various public DBs.
Tree insertion statsThe duration to insert a fixed batch of leaves into each tree type.
MiscellaneousTransaction sizes based on how many contract classes are registered in the tx.
Transaction size based on fee payment method | Metric | | |
732842f to
ec6fb94
Compare
633db8a to
36af398
Compare
36af398 to
b5b7991
Compare
| contract.withWallet(other).methods.set_authorized(authorized.getAddress()).send().wait(), | ||
| ).rejects.toThrow('caller is not admin'); | ||
| it('non-admin cannot set authorized', async () => { | ||
| await expect(contract.withWallet(other).methods.set_authorized(authorized.getAddress()).prove()).rejects.toThrow( |
There was a problem hiding this comment.
Randomly stumbled upon this and sneaked it in. Sending and waiting for the tx was unnecessary here.
| expect(transactionFee).toBeGreaterThan(0); | ||
| // In total 4 notes should be inserted: 1 change note for user, 1 flat fee note for fee payer, 1 refund note for | ||
| // user and 1 fee note for fee payer. | ||
| expect(debugInfo?.noteHashes.length).toBe(4); |
There was a problem hiding this comment.
Added the num notes check here since I wanted to use num notes in the following test and I needed to sanity-check that I am counting the notes correctly.
| // There should be 3 nullifiers emitted: 1 for tx hash, 1 for user randomness (emitted in FPC), 1 for the note user | ||
| // paid the funded amount with. | ||
| // expect(debugInfo?.nullifiers.length).toBe(3); // This is actually 4. Does the reviewer know why? I can't find | ||
| // the last nullifier. If not I'll just nuke this check as it's not that important. |
There was a problem hiding this comment.
I could not find the where the 4th nullifier is coming from. If you the reviewer don't know as well I will just nuke the check as it's not that important.
| @@ -136,23 +149,32 @@ describe('e2e_fees/private_refunds', () => { | |||
| const aliceRandomness = Fr.random(); // Called user_randomness in contracts | |||
There was a problem hiding this comment.
This test is not really finished because I can't check balances etc. because of #7717.
|
Closing this as it's not planned to be finished in the near future and the approach implemented here is most likely incorrect. |

Fixes #7650
The fee payer needs to take a flat fee in the non-revertible part of a tx (in this PR's case in a private setup) to protect itself from a griefing attack by the user. Griefing could occur in case the public part of tx reverted --> then the fee payer would not receive the fee note.
Note: The tests in this PR are not finished because I was unable to do so due to #7717