Skip to content

Commit 3ea051d

Browse files
committed
Merge remote-tracking branch 'origin/staging' into explorer-new-version
2 parents 6e3cf58 + 9ca55fb commit 3ea051d

File tree

30 files changed

+892700
-8381
lines changed

30 files changed

+892700
-8381
lines changed

aggregator/pkg/aggregator.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,12 @@ func (agg *Aggregator) handleBlsAggServiceResponse(blsAggServiceResp blsagg.BlsA
295295
if err == nil {
296296
// In some cases, we may fail to retrieve the receipt for the transaction.
297297
txHash := "Unknown"
298+
effectiveGasPrice := "Unknown"
298299
if receipt != nil {
299300
txHash = receipt.TxHash.String()
301+
effectiveGasPrice = receipt.EffectiveGasPrice.String()
300302
}
301-
agg.telemetry.TaskSentToEthereum(batchData.BatchMerkleRoot, txHash)
303+
agg.telemetry.TaskSentToEthereum(batchData.BatchMerkleRoot, txHash, effectiveGasPrice)
302304
agg.logger.Info("Aggregator successfully responded to task",
303305
"taskIndex", blsAggServiceResp.TaskIndex,
304306
"batchIdentifierHash", "0x"+hex.EncodeToString(batchIdentifierHash[:]))
@@ -326,9 +328,8 @@ func (agg *Aggregator) sendAggregatedResponse(batchIdentifierHash [32]byte, batc
326328
"batchIdentifierHash", hex.EncodeToString(batchIdentifierHash[:]))
327329

328330
// This function is a callback that is called when the gas price is bumped on the avsWriter.SendAggregatedResponse
329-
onGasPriceBumped := func(bumpedGasPrice *big.Int) {
330-
agg.metrics.IncBumpedGasPriceForAggregatedResponse()
331-
agg.telemetry.BumpedTaskGasPrice(batchMerkleRoot, bumpedGasPrice.String())
331+
onSetGasPrice := func(gasPrice *big.Int) {
332+
agg.telemetry.TaskSetGasPrice(batchMerkleRoot, gasPrice.String())
332333
}
333334

334335
startTime := time.Now()
@@ -341,12 +342,12 @@ func (agg *Aggregator) sendAggregatedResponse(batchIdentifierHash [32]byte, batc
341342
agg.AggregatorConfig.Aggregator.GasBumpIncrementalPercentage,
342343
agg.AggregatorConfig.Aggregator.GasBumpPercentageLimit,
343344
agg.AggregatorConfig.Aggregator.TimeToWaitBeforeBump,
344-
onGasPriceBumped,
345+
agg.metrics,
346+
onSetGasPrice,
345347
)
346348
if err != nil {
347349
agg.walletMutex.Unlock()
348350
agg.logger.Infof("- Unlocked Wallet Resources: Error sending aggregated response for batch %s. Error: %s", hex.EncodeToString(batchIdentifierHash[:]), err)
349-
agg.telemetry.LogTaskError(batchMerkleRoot, err)
350351
return nil, err
351352
}
352353

aggregator/pkg/telemetry.go

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ type TaskErrorMessage struct {
3030
TaskError string `json:"error"`
3131
}
3232

33-
type TaskGasPriceBumpMessage struct {
34-
MerkleRoot string `json:"merkle_root"`
35-
BumpedGasPrice string `json:"bumped_gas_price"`
33+
type TaskSetGasPriceMessage struct {
34+
MerkleRoot string `json:"merkle_root"`
35+
GasPrice string `json:"gas_price"`
3636
}
3737

3838
type TaskSentToEthereumMessage struct {
39-
MerkleRoot string `json:"merkle_root"`
40-
TxHash string `json:"tx_hash"`
39+
MerkleRoot string `json:"merkle_root"`
40+
TxHash string `json:"tx_hash"`
41+
EffectiveGasPrice string `json:"effective_gas_price"`
4142
}
4243

4344
type Telemetry struct {
@@ -101,20 +102,21 @@ func (t *Telemetry) LogTaskError(batchMerkleRoot [32]byte, taskError error) {
101102
}
102103
}
103104

104-
func (t *Telemetry) BumpedTaskGasPrice(batchMerkleRoot [32]byte, bumpedGasPrice string) {
105-
body := TaskGasPriceBumpMessage{
106-
MerkleRoot: fmt.Sprintf("0x%s", hex.EncodeToString(batchMerkleRoot[:])),
107-
BumpedGasPrice: bumpedGasPrice,
105+
func (t *Telemetry) TaskSetGasPrice(batchMerkleRoot [32]byte, gasPrice string) {
106+
body := TaskSetGasPriceMessage{
107+
MerkleRoot: fmt.Sprintf("0x%s", hex.EncodeToString(batchMerkleRoot[:])),
108+
GasPrice: gasPrice,
108109
}
109-
if err := t.sendTelemetryMessage("/api/aggregatorTaskGasPriceBump", body); err != nil {
110+
if err := t.sendTelemetryMessage("/api/aggregatorTaskSetGasPrice", body); err != nil {
110111
t.logger.Warn("[Telemetry] Error in LogOperatorResponse", "error", err)
111112
}
112113
}
113114

114-
func (t *Telemetry) TaskSentToEthereum(batchMerkleRoot [32]byte, txHash string) {
115+
func (t *Telemetry) TaskSentToEthereum(batchMerkleRoot [32]byte, txHash string, effectiveGasPrice string) {
115116
body := TaskSentToEthereumMessage{
116-
MerkleRoot: fmt.Sprintf("0x%s", hex.EncodeToString(batchMerkleRoot[:])),
117-
TxHash: txHash,
117+
MerkleRoot: fmt.Sprintf("0x%s", hex.EncodeToString(batchMerkleRoot[:])),
118+
TxHash: txHash,
119+
EffectiveGasPrice: effectiveGasPrice,
118120
}
119121
if err := t.sendTelemetryMessage("/api/aggregatorTaskSent", body); err != nil {
120122
t.logger.Warn("[Telemetry] Error in TaskSentToEthereum", "error", err)

audits/erc20_contracts/creed.pdf

1.46 MB
Binary file not shown.
642 KB
Binary file not shown.
220 KB
Binary file not shown.

claim_contracts/Makefile

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ help: ## 📚 Show help for each of the Makefile recipes
77
# Deployments
88

99
RPC_URL?=http://localhost:8545
10-
PRIVATE_KEY?=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
10+
DEPLOYER_PRIVATE_KEY?=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
1111
CONFIG?=example
1212
deploy-token: ## 🚀 Deploy the token contract
1313
cd script && \
1414
forge script DeployAlignedToken.s.sol \
1515
--sig "run(string)" \
1616
$(CONFIG) \
17-
--private-key $(PRIVATE_KEY) \
17+
--private-key $(DEPLOYER_PRIVATE_KEY) \
1818
--rpc-url $(RPC_URL) \
1919
--broadcast \
2020
--verbosity 3
@@ -23,7 +23,7 @@ deploy-token-testnet: ## 🚀 Deploy the token contract
2323
cd script && \
2424
forge script DeployAlignedToken.s.sol \
2525
--sig "run(string)" sepolia
26-
--private-key $(PRIVATE_KEY) \
26+
--private-key $(DEPLOYER_PRIVATE_KEY) \
2727
--rpc-url $(RPC_URL) \
2828
--broadcast \
2929
--verbosity 3
@@ -42,15 +42,15 @@ deploy-claimable-local: ## 🚀 Deploy the airdrop contract in localnet
4242
cd script && \
4343
forge script DeployClaimableAirdrop.s.sol \
4444
--sig "run(string)" example \
45-
--private-key $(PRIVATE_KEY) \
45+
--private-key $(DEPLOYER_PRIVATE_KEY) \
4646
--rpc-url http://localhost:8545 \
4747
--broadcast
4848

4949
deploy-claimable-testnet: ## 🚀 Deploy the airdrop contract in Sepolia
5050
cd script && \
5151
forge script DeployClaimableAirdrop.s.sol \
5252
--sig "run(string)" sepolia \
53-
--private-key $(PRIVATE_KEY) \
53+
--private-key $(DEPLOYER_PRIVATE_KEY) \
5454
--rpc-url $(RPC_URL) \
5555
--broadcast \
5656
--verify \
@@ -85,6 +85,9 @@ upgrade-token: ## 🚀 Upgrade the token contract
8585
# Miscellaneous
8686

8787
DISTRIBUTOR_PRIVATE_KEY?=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
88+
OWNER_PRIVATE_KEY=0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a
89+
AIRDROP=0xBC9129Dc0487fc2E169941C75aABC539f208fb01
90+
TOKEN=0x2E983A1Ba5e8b38AAAeC4B440B9dDcFBf72E15d1
8891

8992
approve-claimable: ## 🚀 Approve the ClaimableAirdrop contract to spend the token
9093
cast send \
@@ -96,7 +99,7 @@ approve-claimable: ## 🚀 Approve the ClaimableAirdrop contract to spend the to
9699
claimable-update-root: ## 🚀 Update the merkle root of the ClaimableAirdrop contract
97100
cast send \
98101
--rpc-url $(RPC_URL) \
99-
--private-key $(PRIVATE_KEY) \
102+
--private-key $(OWNER_PRIVATE_KEY) \
100103
$(AIRDROP) \
101104
'updateMerkleRoot(bytes32)' $(MERKLE_ROOT)
102105

@@ -109,7 +112,7 @@ claimable-get-root: ## 🚀 Get the merkle root of the ClaimableAirdrop contract
109112
claimable-update-timestamp: ## 🚀 Update the limit timestamp of the ClaimableAirdrop contract
110113
cast send \
111114
--rpc-url $(RPC_URL) \
112-
--private-key $(PRIVATE_KEY) \
115+
--private-key $(OWNER_PRIVATE_KEY) \
113116
$(AIRDROP) \
114117
'extendClaimPeriod(uint256)' $(TIMESTAMP)
115118

@@ -119,16 +122,16 @@ claimable-get-timestamp: ## 🚀 Get the limit timestamp of the ClaimableAirdrop
119122
$(AIRDROP) \
120123
"limitTimestampToClaim()(uint256)"
121124

122-
pause:
125+
claimable-pause:
123126
cast send \
124127
--rpc-url $(RPC_URL) \
125-
--private-key $(PRIVATE_KEY) \
128+
--private-key $(OWNER_PRIVATE_KEY) \
126129
$(AIRDROP) "pause()"
127130

128-
unpause:
131+
claimable-unpause:
129132
cast send \
130133
--rpc-url $(RPC_URL) \
131-
--private-key $(PRIVATE_KEY) \
134+
--private-key $(OWNER_PRIVATE_KEY) \
132135
$(AIRDROP) "unpause()"
133136

134137
# Upgrades
@@ -164,3 +167,6 @@ OWNER_PRIVATE_KEY?=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f
164167
test-airdrop:
165168
cast call $(AIRDROP) "paused()(bool)" --rpc-url $(RPC_URL)
166169
cast call $(AIRDROP) "owner()(address)" --rpc-url $(RPC_URL)
170+
171+
# Requires MERKLE_ROOT, TIMESTAMP
172+
deploy-example: deploy-token deploy-claimable-local claimable-update-root claimable-update-timestamp approve-claimable claimable-unpause

claim_contracts/README.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@
2222
make deploy-claimable-local
2323
```
2424
5. Write down the claimable contract proxy address that is printed in the console output.
25-
6. Approve the claimable contract to spend the token from the distributor
26-
```
27-
make approve-claimable TOKEN=<token-proxy-address> AIRDROP=<claimable-proxy-address> PRIVATE_KEY=0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d
28-
```
2925

3026
## Testnet (Sepolia)
3127

@@ -44,10 +40,34 @@
4440
3. Write down the `token-proxy-address` that is printed in the console output. Do this in the `config.sepolia.json` file, under the `tokenProxy` key.
4541
4. Deploy the claimable contract
4642
```
47-
make deploy-claimable-testnet RPC_URL=<sepolia-rpc-url> PRIVATE_KEY=<sepolia-funded-account-private-key> ETHERSCAN_API_KEY=<etherscan-api-key>
43+
make deploy-claimable-testnet RPC_URL=<sepolia-rpc-url> DEPLOYER_PRIVATE_KEY=<sepolia-funded-account-private-key> ETHERSCAN_API_KEY=<etherscan-api-key>
4844
```
4945
5. Write down the `claimable-proxy-address` that is printed in the console output.
50-
6. Approve the claimable contract to spend the token from the distributor
46+
47+
## Enabling Claimability
48+
49+
### Local
50+
51+
1. Deploy the claimable contract as explained above.
52+
2. Set the correct merkle root
53+
```
54+
make claimable-update-root MERKLE_ROOT=<claims-merkle-root>
55+
```
56+
3. Set the correct claim time limit
5157
```
52-
make approve-claimable TOKEN=<token-proxy-address> AIRDROP=<claimable-proxy-address> PRIVATE_KEY=<sepolia-funded-distributor-private-key>
58+
make claimable-update-timestamp TIMESTAMP=2733427549
5359
```
60+
4. Approve the claimable contract to spend the token from the distributor
61+
```
62+
make approve-claimable
63+
```
64+
5. Unpause the claimable contract
65+
```
66+
make claimable-unpause
67+
```
68+
69+
or
70+
71+
```
72+
make deploy-example MERKLE_ROOT=<claims-merkle-root> TIMESTAMP=2733427549
73+
```

0 commit comments

Comments
 (0)