-
Notifications
You must be signed in to change notification settings - Fork 34
Description
Can add monad on this SDK
Body:
## Summary
`giveFeedback()` always reverts on Monad mainnet (chain 143) because the hardcoded `GIVE_FEEDBACK_GAS_LIMIT = 300000n` is insufficient. The actual gas required on Monad is ~318,617. Additionally, Monad mainnet (chain 143) is not included in `DEFAULT_REGISTRIES`, requiring manual `registryOverrides`.
## Environment
- **SDK version:** 1.5.3
- **Chain:** Monad mainnet (chain 143)
- **RPC:** https://rpc3.monad.xyz
- **Contract:** ReputationRegistry `0x8004BAa17C55a88189AE136b182e5fdA19dE9b63` (deterministic, same as ETH/Base/Polygon)
- **Agent ID:** 8317
## 1: Gas Limit Too Low
In my check `feedback-manager.js`, the gas limit is hardcoded:
```js
const GIVE_FEEDBACK_GAS_LIMIT = 300000n;On Monad (chain 143), giveFeedback requires approximately 318,617 gas — exceeding the hardcoded limit by ~6%. This causes every giveFeedback call to revert.
Reproduction
import { SDK } from 'agent0-sdk';
const sdk = new SDK({
chainId: 143,
rpcUrl: 'https://rpc3.monad.xyz',
privateKey: '0x...',
registryOverrides: {
143: {
IDENTITY: '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432',
REPUTATION: '0x8004BAa17C55a88189AE136b182e5fdA19dE9b63',
},
},
});
// This TX will revert (out of gas)
const tx = await sdk.giveFeedback('143:8317', 50, 'trade_execution', 'test', '');Failed TX (SDK, gas limit 300,000):
Reverts on-chain.
Successful TX (direct viem call, no gas limit cap):
0x1e455ec2bd3625ec832da2506a092f07d088c9be497dbeec1db4b63d294acedf
Block #56687197 — Gas used: 318,617
Workaround
Bypass the SDK and call the contract directly via viem:
import { createWalletClient, http } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
const hash = await walletClient.writeContract({
address: '0x8004BAa17C55a88189AE136b182e5fdA19dE9b63',
abi: REPUTATION_REGISTRY_ABI, // from official contract ABI
functionName: 'giveFeedback',
args: [8317n, 50n, 0, 'trade_execution', 'test', '', '', '0x' + '00'.repeat(32)],
// No gas limit — let the node estimate correctly
});Suggested Fix
Either:
- Increase
GIVE_FEEDBACK_GAS_LIMITto at least350000n(with headroom), or - Make it configurable via SDK options (e.g.,
new SDK({ gasOverrides: { giveFeedback: 400000n } })), or - Remove it and let the RPC node estimate gas automatically (as the comment notes, some RPC providers have issues — but Monad doesn't)
2: Monad (chain 143) Not in DEFAULT_REGISTRIES
The ERC-8004 contracts are deployed on Monad mainnet at the same deterministic addresses:
- Identity:
0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 - Reputation:
0x8004BAa17C55a88189AE136b182e5fdA19dE9b63
But chain 143 is not listed in DEFAULT_REGISTRIES in contracts.js. Without registryOverrides, the SDK throws:
Error: No reputation registry address for chain 143
Suggested Fix
Add Monad to DEFAULT_REGISTRIES:
143: {
// Monad Mainnet
IDENTITY: '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432',
REPUTATION: '0x8004BAa17C55a88189AE136b182e5fdA19dE9b63',
},Impact
Any project using agent0-sdk on Monad cannot use giveFeedback() at all — the gas limit silently kills every transaction. The registryOverrides workaround solves the registry lookup, but the gas issue remains a blocker.
We are running an autonomous ERC-8004 trading agent on Monad mainnet and discovered this while integrating on-chain reputation feedback.