Skip to content

Instantly share code, notes, and snippets.

@Man-Jain
Created January 13, 2024 10:20
Show Gist options
  • Save Man-Jain/f7e0e7ac767412b4f1f026b7de0dc37b to your computer and use it in GitHub Desktop.
Save Man-Jain/f7e0e7ac767412b4f1f026b7de0dc37b to your computer and use it in GitHub Desktop.
{
"type": "Error",
"message": "bad response (status=403, headers={\"access-control-allow-credentials\":\"true\",\"access-control-allow-headers\":\"Content-Type,Authorization,User-Agent\",\"access-control-allow-methods\":\"GET, POST, OPTIONS\",\"access-control-allow-origin\":\"\",\"content-type\":\"application/json\",\"vary\":\"Accept-Encoding\",\"x-node-id\":\"08777362-575c-4584-aa42-4f09eb19af92\",\"date\":\"Fri, 12 Jan 2024 11:50:10 GMT\",\"content-length\":\"132\",\"connection\":\"close\"}, body=\"{\\\"jsonrpc\\\":\\\"2.0\\\",\\\"id\\\":40720,\\\"error\\\":{\\\"code\\\":-32612,\\\"message\\\":\\\"custom traces are blocked. contact sales at quicknode.com to enable\\\"}}\", requestBody=\"{\\\"method\\\":\\\"debug_traceCall\\\",\\\"params\\\":[{\\\"to\\\":\\\"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789\\\",\\\"data\\\":\\\"0xee2194230000000000000000000000000000000000000000000000000000000000000020000000000000000000000000e6c18e77782c628eb2d0501f5adf654c08e62a9800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000055c4000000000000000000000000000000000000000000000000000000000005fedf000000000000000000000000000000000000000000000000000000000000bdb80000000000000000000000000000000000000000000000000000000343a3a7840000000000000000000000000000000000000000000000000000000059682f000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000002984e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec671688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c7620000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e4b63e800d000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000008ecd4ec46d4d2a6b64fe960b3d64e8b94b2234eb0000000000000000000000000000000000000000000000000000000000000140000000000000000000000000a581c4a4db7175302464ff3c06380bc3270b403700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000007c865c14f9dcdcbfd078c9ed10be313f2e1012b900000000000000000000000000000000000000000000000000000000000000648d0dc49f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a581c4a4db7175302464ff3c06380bc3270b40370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a47bb374280000000000000000000000007c865c14f9dcdcbfd078c9ed10be313f2e1012b90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004d000065a12766000067825ae63eb52bea5320cfc99918b3a889755389fa3b5a84f98647bc621084341d73b30b696e0c4cb1782cc24f6eb13d170d11d1efee7b29ffb62db1ebb98553aaa13c531b00000000000000000000000000000000000000\\\",\\\"gas\\\":\\\"0x7125b\\\"},\\\"latest\\\",{\\\"tracer\\\":\\\"{\\\\n callsFromEntryPoint: [],\\\\n currentLevel: null,\\\\n keccak: [],\\\\n calls: [],\\\\n logs: [],\\\\n debug: [],\\\\n lastOp: \\\\\\\"\\\\\\\",\\\\n lastThreeOpcodes: [],\\\\n stopCollectingTopic: \\\\\\\"bb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972\\\\\\\",\\\\n stopCollecting: false,\\\\n topLevelCallCounter: 0,\\\\n\\\\n fault(log, _db) {\\\\n this.debug.push(\\\\\\\"fault depth=\\\\\\\", log.getDepth(), \\\\\\\" gas=\\\\\\\", log.getGas(), \\\\\\\" cost=\\\\\\\", log.getCost(), \\\\\\\" err=\\\\\\\", log.getError())\\\\n },\\\\n\\\\n result(_ctx, _db) {\\\\n return {\\\\n callsFromEntryPoint: this.callsFromEntryPoint,\\\\n keccak: this.keccak,\\\\n logs: this.logs,\\\\n calls: this.calls,\\\\n debug: this.debug\\\\n }\\\\n },\\\\n\\\\n enter(frame) {\\\\n if (this.stopCollecting) {\\\\n return\\\\n }\\\\n this.calls.push({\\\\n type: frame.getType(),\\\\n from: toHex(frame.getFrom()),\\\\n to: toHex(frame.getTo()),\\\\n method: toHex(frame.getInput()).slice(0, 10),\\\\n gas: frame.getGas(),\\\\n value: frame.getValue()\\\\n })\\\\n },\\\\n exit(frame) {\\\\n if (this.stopCollecting) {\\\\n return\\\\n }\\\\n this.calls.push({\\\\n type: frame.getError() != null ? \\\\\\\"REVERT\\\\\\\" : \\\\\\\"RETURN\\\\\\\",\\\\n gasUsed: frame.getGasUsed(),\\\\n data: toHex(frame.getOutput()).slice(0, 4000)\\\\n })\\\\n },\\\\n\\\\n countSlot(list, key) {\\\\n list[key] = (list[key] || 0) + 1\\\\n },\\\\n step(log, db) {\\\\n if (this.stopCollecting) {\\\\n return\\\\n }\\\\n const opcode = log.op.toString()\\\\n\\\\n const stackSize = log.stack.length()\\\\n const stackTop3 = []\\\\n for (let i = 0; i < 3 && i < stackSize; i++) {\\\\n stackTop3.push(log.stack.peek(i))\\\\n }\\\\n this.lastThreeOpcodes.push({\\\\n opcode,\\\\n stackTop3\\\\n })\\\\n if (this.lastThreeOpcodes.length > 3) {\\\\n this.lastThreeOpcodes.shift()\\\\n }\\\\n if (\\\\n log.getGas() < log.getCost() ||\\\\n (opcode === \\\\\\\"SSTORE\\\\\\\" && log.getGas() < 2300)\\\\n ) {\\\\n this.currentLevel.oog = true\\\\n }\\\\n\\\\n if (opcode === \\\\\\\"REVERT\\\\\\\" || opcode === \\\\\\\"RETURN\\\\\\\") {\\\\n if (log.getDepth() === 1) {\\\\n const ofs = parseInt(log.stack.peek(0).toString())\\\\n const len = parseInt(log.stack.peek(1).toString())\\\\n const data = toHex(log.memory.slice(ofs, ofs + len)).slice(0, 4000)\\\\n this.calls.push({\\\\n type: opcode,\\\\n gasUsed: 0,\\\\n data\\\\n })\\\\n }\\\\n this.lastThreeOpcodes = []\\\\n }\\\\n\\\\n if (log.getDepth() === 1) {\\\\n if (opcode === \\\\\\\"CALL\\\\\\\" || opcode === \\\\\\\"STATICCALL\\\\\\\") {\\\\n const addr = toAddress(log.stack.peek(1).toString(16))\\\\n const topLevelTargetAddress = toHex(addr)\\\\n const ofs = parseInt(log.stack.peek(3).toString())\\\\n const topLevelMethodSig = toHex(log.memory.slice(ofs, ofs + 4))\\\\n\\\\n this.currentLevel = this.callsFromEntryPoint[\\\\n this.topLevelCallCounter\\\\n ] = {\\\\n topLevelMethodSig,\\\\n topLevelTargetAddress,\\\\n access: {},\\\\n opcodes: {},\\\\n extCodeAccessInfo: {},\\\\n contractSize: {}\\\\n }\\\\n this.topLevelCallCounter++\\\\n } else if (opcode === \\\\\\\"LOG1\\\\\\\") {\\\\n const topic = log.stack.peek(2).toString(16)\\\\n if (topic === this.stopCollectingTopic) {\\\\n this.stopCollecting = true\\\\n }\\\\n }\\\\n this.lastOp = \\\\\\\"\\\\\\\"\\\\n return\\\\n }\\\\n\\\\n const lastOpInfo = this.lastThreeOpcodes[this.lastThreeOpcodes.length - 2]\\\\n if (lastOpInfo && lastOpInfo.opcode && lastOpInfo.opcode.match(/^(EXT.*)$/) != null) {\\\\n const addr = toAddress(lastOpInfo.stackTop3[0].toString(16))\\\\n const addrHex = toHex(addr)\\\\n const last3opcodesString = this.lastThreeOpcodes\\\\n .map(x => x.opcode)\\\\n .join(\\\\\\\" \\\\\\\")\\\\n if (last3opcodesString.match(/^(\\\\\\\\w+) EXTCODESIZE ISZERO$/) == null) {\\\\n this.currentLevel.extCodeAccessInfo[addrHex] = opcode\\\\n }\\\\n }\\\\n const isAllowedPrecompiled = address => {\\\\n const addrHex = toHex(address)\\\\n const addressInt = parseInt(addrHex)\\\\n return addressInt > 0 && addressInt < 10\\\\n }\\\\n if (\\\\n opcode.match(/^(EXT.*|CALL|CALLCODE|DELEGATECALL|STATICCALL)$/) != null\\\\n ) {\\\\n const idx = opcode.startsWith(\\\\\\\"EXT\\\\\\\") ? 0 : 1\\\\n const addr = toAddress(log.stack.peek(idx).toString(16))\\\\n const addrHex = toHex(addr)\\\\n if (\\\\n this.currentLevel.contractSize[addrHex] == null &&\\\\n !isAllowedPrecompiled(addr)\\\\n ) {\\\\n this.currentLevel.contractSize[addrHex] = {\\\\n contractSize: db.getCode(addr).length,\\\\n opcode\\\\n }\\\\n }\\\\n }\\\\n\\\\n if (this.lastOp === \\\\\\\"GAS\\\\\\\" && !opcode.includes(\\\\\\\"CALL\\\\\\\")) {\\\\n this.countSlot(this.currentLevel.opcodes, \\\\\\\"GAS\\\\\\\")\\\\n }\\\\n if (opcode !== \\\\\\\"GAS\\\\\\\") {\\\\n if (\\\\n opcode.match(\\\\n /^(DUP\\\\\\\\d+|PUSH\\\\\\\\d+|SWAP\\\\\\\\d+|POP|ADD|SUB|MUL|DIV|EQ|LTE?|S?GTE?|SLT|SH[LR]|AND|OR|NOT|ISZERO)$/\\\\n ) == null\\\\n ) {\\\\n this.countSlot(this.currentLevel.opcodes, opcode)\\\\n }\\\\n }\\\\n this.lastOp = opcode\\\\n\\\\n if (opcode === \\\\\\\"SLOAD\\\\\\\" || opcode === \\\\\\\"SSTORE\\\\\\\") {\\\\n const slot = toWord(log.stack.peek(0).toString(16))\\\\n const slotHex = toHex(slot)\\\\n const addr = log.contract.getAddress()\\\\n const addrHex = toHex(addr)\\\\n let access = this.currentLevel.access[addrHex]\\\\n if (access == null) {\\\\n access = {\\\\n reads: {},\\\\n writes: {}\\\\n }\\\\n this.currentLevel.access[addrHex] = access\\\\n }\\\\n if (opcode === \\\\\\\"SLOAD\\\\\\\") {\\\\n if (access.reads[slotHex] == null && access.writes[slotHex] == null) {\\\\n access.reads[slotHex] = toHex(db.getState(addr, slot))\\\\n }\\\\n } else {\\\\n this.countSlot(access.writes, slotHex)\\\\n }\\\\n }\\\\n\\\\n if (opcode === \\\\\\\"KECCAK256\\\\\\\") {\\\\n const ofs = parseInt(log.stack.peek(0).toString())\\\\n const len = parseInt(log.stack.peek(1).toString())\\\\n if (len > 20 && len < 512) {\\\\n this.keccak.push(toHex(log.memory.slice(ofs, ofs + len)))\\\\n }\\\\n } else if (opcode.startsWith(\\\\\\\"LOG\\\\\\\")) {\\\\n const count = parseInt(opcode.substring(3))\\\\n const ofs = parseInt(log.stack.peek(0).toString())\\\\n const len = parseInt(log.stack.peek(1).toString())\\\\n const topics = []\\\\n for (let i = 0; i < count; i++) {\\\\n topics.push(\\\\\\\"0x\\\\\\\" + log.stack.peek(2 + i).toString(16))\\\\n }\\\\n const data = toHex(log.memory.slice(ofs, ofs + len))\\\\n this.logs.push({\\\\n topics,\\\\n data\\\\n })\\\\n }\\\\n }\\\\n }\\\"}],\\\"id\\\":40720,\\\"jsonrpc\\\":\\\"2.0\\\"}\", requestMethod=\"POST\", url=\"https://frosty-solemn-diamond.matic.quiknode.pro/ae32fe5b91c1e127c4e6a065fe17d469910095c0\", code=SERVER_ERROR, version=web/5.7.1)",
"stack":
Error: bad response (status=403, headers={"access-control-allow-credentials":"true","access-control-allow-headers":"Content-Type,Authorization,User-Agent","access-control-allow-methods":"GET, POST, OPTIONS","access-control-allow-origin":"","content-type":"application/json","vary":"Accept-Encoding","x-node-id":"08777362-575c-4584-aa42-4f09eb19af92","date":"Fri, 12 Jan 2024 11:50:10 GMT","content-length":"132","connection":"close"}, body="{\"jsonrpc\":\"2.0\",\"id\":40720,\"error\":{\"code\":-32612,\"message\":\"custom traces are blocked. contact sales at quicknode.com to enable\"}}", requestBody="{\"method\":\"debug_traceCall\",\"params\":[{\"to\":\"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789\",\"data\":\"0xee2194230000000000000000000000000000000000000000000000000000000000000020000000000000000000000000e6c18e77782c628eb2d0501f5adf654c08e62a9800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000055c4000000000000000000000000000000000000000000000000000000000005fedf000000000000000000000000000000000000000000000000000000000000bdb80000000000000000000000000000000000000000000000000000000343a3a7840000000000000000000000000000000000000000000000000000000059682f000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000002984e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec671688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c7620000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e4b63e800d000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000008ecd4ec46d4d2a6b64fe960b3d64e8b94b2234eb0000000000000000000000000000000000000000000000000000000000000140000000000000000000000000a581c4a4db7175302464ff3c06380bc3270b403700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000007c865c14f9dcdcbfd078c9ed10be313f2e1012b900000000000000000000000000000000000000000000000000000000000000648d0dc49f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a581c4a4db7175302464ff3c06380bc3270b40370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a47bb374280000000000000000000000007c865c14f9dcdcbfd078c9ed10be313f2e1012b90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004d000065a12766000067825ae63eb52bea5320cfc99918b3a889755389fa3b5a84f98647bc621084341d73b30b696e0c4cb1782cc24f6eb13d170d11d1efee7b29ffb62db1ebb98553aaa13c531b00000000000000000000000000000000000000\",\"gas\":\"0x7125b\"},\"latest\",{\"tracer\":\"{\\n callsFromEntryPoint: [],\\n currentLevel: null,\\n keccak: [],\\n calls: [],\\n logs: [],\\n debug: [],\\n lastOp: \\\"\\\",\\n lastThreeOpcodes: [],\\n stopCollectingTopic: \\\"bb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972\\\",\\n stopCollecting: false,\\n topLevelCallCounter: 0,\\n\\n fault(log, _db) {\\n this.debug.push(\\\"fault depth=\\\", log.getDepth(), \\\" gas=\\\", log.getGas(), \\\" cost=\\\", log.getCost(), \\\" err=\\\", log.getError())\\n },\\n\\n result(_ctx, _db) {\\n return {\\n callsFromEntryPoint: this.callsFromEntryPoint,\\n keccak: this.keccak,\\n logs: this.logs,\\n calls: this.calls,\\n debug: this.debug\\n }\\n },\\n\\n enter(frame) {\\n if (this.stopCollecting) {\\n return\\n }\\n this.calls.push({\\n type: frame.getType(),\\n from: toHex(frame.getFrom()),\\n to: toHex(frame.getTo()),\\n method: toHex(frame.getInput()).slice(0, 10),\\n gas: frame.getGas(),\\n value: frame.getValue()\\n })\\n },\\n exit(frame) {\\n if (this.stopCollecting) {\\n return\\n }\\n this.calls.push({\\n type: frame.getError() != null ? \\\"REVERT\\\" : \\\"RETURN\\\",\\n gasUsed: frame.getGasUsed(),\\n data: toHex(frame.getOutput()).slice(0, 4000)\\n })\\n },\\n\\n countSlot(list, key) {\\n list[key] = (list[key] || 0) + 1\\n },\\n step(log, db) {\\n if (this.stopCollecting) {\\n return\\n }\\n const opcode = log.op.toString()\\n\\n const stackSize = log.stack.length()\\n const stackTop3 = []\\n for (let i = 0; i < 3 && i < stackSize; i++) {\\n stackTop3.push(log.stack.peek(i))\\n }\\n this.lastThreeOpcodes.push({\\n opcode,\\n stackTop3\\n })\\n if (this.lastThreeOpcodes.length > 3) {\\n this.lastThreeOpcodes.shift()\\n }\\n if (\\n log.getGas() < log.getCost() ||\\n (opcode === \\\"SSTORE\\\" && log.getGas() < 2300)\\n ) {\\n this.currentLevel.oog = true\\n }\\n\\n if (opcode === \\\"REVERT\\\" || opcode === \\\"RETURN\\\") {\\n if (log.getDepth() === 1) {\\n const ofs = parseInt(log.stack.peek(0).toString())\\n const len = parseInt(log.stack.peek(1).toString())\\n const data = toHex(log.memory.slice(ofs, ofs + len)).slice(0, 4000)\\n this.calls.push({\\n type: opcode,\\n gasUsed: 0,\\n data\\n })\\n }\\n this.lastThreeOpcodes = []\\n }\\n\\n if (log.getDepth() === 1) {\\n if (opcode === \\\"CALL\\\" || opcode === \\\"STATICCALL\\\") {\\n const addr = toAddress(log.stack.peek(1).toString(16))\\n const topLevelTargetAddress = toHex(addr)\\n const ofs = parseInt(log.stack.peek(3).toString())\\n const topLevelMethodSig = toHex(log.memory.slice(ofs, ofs + 4))\\n\\n this.currentLevel = this.callsFromEntryPoint[\\n this.topLevelCallCounter\\n ] = {\\n topLevelMethodSig,\\n topLevelTargetAddress,\\n access: {},\\n opcodes: {},\\n extCodeAccessInfo: {},\\n contractSize: {}\\n }\\n this.topLevelCallCounter++\\n } else if (opcode === \\\"LOG1\\\") {\\n const topic = log.stack.peek(2).toString(16)\\n if (topic === this.stopCollectingTopic) {\\n this.stopCollecting = true\\n }\\n }\\n this.lastOp = \\\"\\\"\\n return\\n }\\n\\n const lastOpInfo = this.lastThreeOpcodes[this.lastThreeOpcodes.length - 2]\\n if (lastOpInfo && lastOpInfo.opcode && lastOpInfo.opcode.match(/^(EXT.*)$/) != null) {\\n const addr = toAddress(lastOpInfo.stackTop3[0].toString(16))\\n const addrHex = toHex(addr)\\n const last3opcodesString = this.lastThreeOpcodes\\n .map(x => x.opcode)\\n .join(\\\" \\\")\\n if (last3opcodesString.match(/^(\\\\w+) EXTCODESIZE ISZERO$/) == null) {\\n this.currentLevel.extCodeAccessInfo[addrHex] = opcode\\n }\\n }\\n const isAllowedPrecompiled = address => {\\n const addrHex = toHex(address)\\n const addressInt = parseInt(addrHex)\\n return addressInt > 0 && addressInt < 10\\n }\\n if (\\n opcode.match(/^(EXT.*|CALL|CALLCODE|DELEGATECALL|STATICCALL)$/) != null\\n ) {\\n const idx = opcode.startsWith(\\\"EXT\\\") ? 0 : 1\\n const addr = toAddress(log.stack.peek(idx).toString(16))\\n const addrHex = toHex(addr)\\n if (\\n this.currentLevel.contractSize[addrHex] == null &&\\n !isAllowedPrecompiled(addr)\\n ) {\\n this.currentLevel.contractSize[addrHex] = {\\n contractSize: db.getCode(addr).length,\\n opcode\\n }\\n }\\n }\\n\\n if (this.lastOp === \\\"GAS\\\" && !opcode.includes(\\\"CALL\\\")) {\\n this.countSlot(this.currentLevel.opcodes, \\\"GAS\\\")\\n }\\n if (opcode !== \\\"GAS\\\") {\\n if (\\n opcode.match(\\n /^(DUP\\\\d+|PUSH\\\\d+|SWAP\\\\d+|POP|ADD|SUB|MUL|DIV|EQ|LTE?|S?GTE?|SLT|SH[LR]|AND|OR|NOT|ISZERO)$/\\n ) == null\\n ) {\\n this.countSlot(this.currentLevel.opcodes, opcode)\\n }\\n }\\n this.lastOp = opcode\\n\\n if (opcode === \\\"SLOAD\\\" || opcode === \\\"SSTORE\\\") {\\n const slot = toWord(log.stack.peek(0).toString(16))\\n const slotHex = toHex(slot)\\n const addr = log.contract.getAddress()\\n const addrHex = toHex(addr)\\n let access = this.currentLevel.access[addrHex]\\n if (access == null) {\\n access = {\\n reads: {},\\n writes: {}\\n }\\n this.currentLevel.access[addrHex] = access\\n }\\n if (opcode === \\\"SLOAD\\\") {\\n if (access.reads[slotHex] == null && access.writes[slotHex] == null) {\\n access.reads[slotHex] = toHex(db.getState(addr, slot))\\n }\\n } else {\\n this.countSlot(access.writes, slotHex)\\n }\\n }\\n\\n if (opcode === \\\"KECCAK256\\\") {\\n const ofs = parseInt(log.stack.peek(0).toString())\\n const len = parseInt(log.stack.peek(1).toString())\\n if (len > 20 && len < 512) {\\n this.keccak.push(toHex(log.memory.slice(ofs, ofs + len)))\\n }\\n } else if (opcode.startsWith(\\\"LOG\\\")) {\\n const count = parseInt(opcode.substring(3))\\n const ofs = parseInt(log.stack.peek(0).toString())\\n const len = parseInt(log.stack.peek(1).toString())\\n const topics = []\\n for (let i = 0; i < count; i++) {\\n topics.push(\\\"0x\\\" + log.stack.peek(2 + i).toString(16))\\n }\\n const data = toHex(log.memory.slice(ofs, ofs + len))\\n this.logs.push({\\n topics,\\n data\\n })\\n }\\n }\\n }\"}],\"id\":40720,\"jsonrpc\":\"2.0\"}", requestMethod="POST", url="https://frosty-solemn-diamond.matic.quiknode.pro/ae32fe5b91c1e127c4e6a065fe17d469910095c0", code=SERVER_ERROR, version=web/5.7.1)
at Logger.makeError (/usr/app/node_modules/@ethersproject/logger/lib/index.js:238:21)
at Logger.throwError (/usr/app/node_modules/@ethersproject/logger/lib/index.js:247:20)
at /usr/app/node_modules/@ethersproject/web/lib/index.js:275:36
at step (/usr/app/node_modules/@ethersproject/web/lib/index.js:33:23)
at Object.next (/usr/app/node_modules/@ethersproject/web/lib/index.js:14:53)
at fulfilled (/usr/app/node_modules/@ethersproject/web/lib/index.js:5:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
"reason": "bad response",
"code": "SERVER_ERROR",
"status": 403,
"headers": {
"access-control-allow-credentials": "true",
"access-control-allow-headers": "Content-Type,Authorization,User-Agent",
"access-control-allow-methods": "GET, POST, OPTIONS",
"access-control-allow-origin": "",
"content-type": "application/json",
"vary": "Accept-Encoding",
"x-node-id": "08777362-575c-4584-aa42-4f09eb19af92",
"date": "Fri, 12 Jan 2024 11:50:10 GMT",
"content-length": "132",
"connection": "close"
},
"body": "{\"jsonrpc\":\"2.0\",\"id\":40720,\"error\":{\"code\":-32612,\"message\":\"custom traces are blocked. contact sales at quicknode.com to enable\"}}",
"requestBody": "{\"method\":\"debug_traceCall\",\"params\":[{\"to\":\"0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789\",\"data\":\"0xee2194230000000000000000000000000000000000000000000000000000000000000020000000000000000000000000e6c18e77782c628eb2d0501f5adf654c08e62a9800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000160000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000055c4000000000000000000000000000000000000000000000000000000000005fedf000000000000000000000000000000000000000000000000000000000000bdb80000000000000000000000000000000000000000000000000000000343a3a7840000000000000000000000000000000000000000000000000000000059682f000000000000000000000000000000000000000000000000000000000000000500000000000000000000000000000000000000000000000000000000000000052000000000000000000000000000000000000000000000000000000000000002984e1dcf7ad4e460cfd30791ccc4f9c8a4f820ec671688f0b900000000000000000000000029fcb43b46531bca003ddc8fcb67ffe91900c7620000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001e4b63e800d000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000010000000000000000000000008ecd4ec46d4d2a6b64fe960b3d64e8b94b2234eb0000000000000000000000000000000000000000000000000000000000000140000000000000000000000000a581c4a4db7175302464ff3c06380bc3270b403700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000007c865c14f9dcdcbfd078c9ed10be313f2e1012b900000000000000000000000000000000000000000000000000000000000000648d0dc49f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000a581c4a4db7175302464ff3c06380bc3270b40370000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a47bb374280000000000000000000000007c865c14f9dcdcbfd078c9ed10be313f2e1012b90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004d000065a12766000067825ae63eb52bea5320cfc99918b3a889755389fa3b5a84f98647bc621084341d73b30b696e0c4cb1782cc24f6eb13d170d11d1efee7b29ffb62db1ebb98553aaa13c531b00000000000000000000000000000000000000\",\"gas\":\"0x7125b\"},\"latest\",{\"tracer\":\"{\\n callsFromEntryPoint: [],\\n currentLevel: null,\\n keccak: [],\\n calls: [],\\n logs: [],\\n debug: [],\\n lastOp: \\\"\\\",\\n lastThreeOpcodes: [],\\n stopCollectingTopic: \\\"bb47ee3e183a558b1a2ff0874b079f3fc5478b7454eacf2bfc5af2ff5878f972\\\",\\n stopCollecting: false,\\n topLevelCallCounter: 0,\\n\\n fault(log, _db) {\\n this.debug.push(\\\"fault depth=\\\", log.getDepth(), \\\" gas=\\\", log.getGas(), \\\" cost=\\\", log.getCost(), \\\" err=\\\", log.getError())\\n },\\n\\n result(_ctx, _db) {\\n return {\\n callsFromEntryPoint: this.callsFromEntryPoint,\\n keccak: this.keccak,\\n logs: this.logs,\\n calls: this.calls,\\n debug: this.debug\\n }\\n },\\n\\n enter(frame) {\\n if (this.stopCollecting) {\\n return\\n }\\n this.calls.push({\\n type: frame.getType(),\\n from: toHex(frame.getFrom()),\\n to: toHex(frame.getTo()),\\n method: toHex(frame.getInput()).slice(0, 10),\\n gas: frame.getGas(),\\n value: frame.getValue()\\n })\\n },\\n exit(frame) {\\n if (this.stopCollecting) {\\n return\\n }\\n this.calls.push({\\n type: frame.getError() != null ? \\\"REVERT\\\" : \\\"RETURN\\\",\\n gasUsed: frame.getGasUsed(),\\n data: toHex(frame.getOutput()).slice(0, 4000)\\n })\\n },\\n\\n countSlot(list, key) {\\n list[key] = (list[key] || 0) + 1\\n },\\n step(log, db) {\\n if (this.stopCollecting) {\\n return\\n }\\n const opcode = log.op.toString()\\n\\n const stackSize = log.stack.length()\\n const stackTop3 = []\\n for (let i = 0; i < 3 && i < stackSize; i++) {\\n stackTop3.push(log.stack.peek(i))\\n }\\n this.lastThreeOpcodes.push({\\n opcode,\\n stackTop3\\n })\\n if (this.lastThreeOpcodes.length > 3) {\\n this.lastThreeOpcodes.shift()\\n }\\n if (\\n log.getGas() < log.getCost() ||\\n (opcode === \\\"SSTORE\\\" && log.getGas() < 2300)\\n ) {\\n this.currentLevel.oog = true\\n }\\n\\n if (opcode === \\\"REVERT\\\" || opcode === \\\"RETURN\\\") {\\n if (log.getDepth() === 1) {\\n const ofs = parseInt(log.stack.peek(0).toString())\\n const len = parseInt(log.stack.peek(1).toString())\\n const data = toHex(log.memory.slice(ofs, ofs + len)).slice(0, 4000)\\n this.calls.push({\\n type: opcode,\\n gasUsed: 0,\\n data\\n })\\n }\\n this.lastThreeOpcodes = []\\n }\\n\\n if (log.getDepth() === 1) {\\n if (opcode === \\\"CALL\\\" || opcode === \\\"STATICCALL\\\") {\\n const addr = toAddress(log.stack.peek(1).toString(16))\\n const topLevelTargetAddress = toHex(addr)\\n const ofs = parseInt(log.stack.peek(3).toString())\\n const topLevelMethodSig = toHex(log.memory.slice(ofs, ofs + 4))\\n\\n this.currentLevel = this.callsFromEntryPoint[\\n this.topLevelCallCounter\\n ] = {\\n topLevelMethodSig,\\n topLevelTargetAddress,\\n access: {},\\n opcodes: {},\\n extCodeAccessInfo: {},\\n contractSize: {}\\n }\\n this.topLevelCallCounter++\\n } else if (opcode === \\\"LOG1\\\") {\\n const topic = log.stack.peek(2).toString(16)\\n if (topic === this.stopCollectingTopic) {\\n this.stopCollecting = true\\n }\\n }\\n this.lastOp = \\\"\\\"\\n return\\n }\\n\\n const lastOpInfo = this.lastThreeOpcodes[this.lastThreeOpcodes.length - 2]\\n if (lastOpInfo && lastOpInfo.opcode && lastOpInfo.opcode.match(/^(EXT.*)$/) != null) {\\n const addr = toAddress(lastOpInfo.stackTop3[0].toString(16))\\n const addrHex = toHex(addr)\\n const last3opcodesString = this.lastThreeOpcodes\\n .map(x => x.opcode)\\n .join(\\\" \\\")\\n if (last3opcodesString.match(/^(\\\\w+) EXTCODESIZE ISZERO$/) == null) {\\n this.currentLevel.extCodeAccessInfo[addrHex] = opcode\\n }\\n }\\n const isAllowedPrecompiled = address => {\\n const addrHex = toHex(address)\\n const addressInt = parseInt(addrHex)\\n return addressInt > 0 && addressInt < 10\\n }\\n if (\\n opcode.match(/^(EXT.*|CALL|CALLCODE|DELEGATECALL|STATICCALL)$/) != null\\n ) {\\n const idx = opcode.startsWith(\\\"EXT\\\") ? 0 : 1\\n const addr = toAddress(log.stack.peek(idx).toString(16))\\n const addrHex = toHex(addr)\\n if (\\n this.currentLevel.contractSize[addrHex] == null &&\\n !isAllowedPrecompiled(addr)\\n ) {\\n this.currentLevel.contractSize[addrHex] = {\\n contractSize: db.getCode(addr).length,\\n opcode\\n }\\n }\\n }\\n\\n if (this.lastOp === \\\"GAS\\\" && !opcode.includes(\\\"CALL\\\")) {\\n this.countSlot(this.currentLevel.opcodes, \\\"GAS\\\")\\n }\\n if (opcode !== \\\"GAS\\\") {\\n if (\\n opcode.match(\\n /^(DUP\\\\d+|PUSH\\\\d+|SWAP\\\\d+|POP|ADD|SUB|MUL|DIV|EQ|LTE?|S?GTE?|SLT|SH[LR]|AND|OR|NOT|ISZERO)$/\\n ) == null\\n ) {\\n this.countSlot(this.currentLevel.opcodes, opcode)\\n }\\n }\\n this.lastOp = opcode\\n\\n if (opcode === \\\"SLOAD\\\" || opcode === \\\"SSTORE\\\") {\\n const slot = toWord(log.stack.peek(0).toString(16))\\n const slotHex = toHex(slot)\\n const addr = log.contract.getAddress()\\n const addrHex = toHex(addr)\\n let access = this.currentLevel.access[addrHex]\\n if (access == null) {\\n access = {\\n reads: {},\\n writes: {}\\n }\\n this.currentLevel.access[addrHex] = access\\n }\\n if (opcode === \\\"SLOAD\\\") {\\n if (access.reads[slotHex] == null && access.writes[slotHex] == null) {\\n access.reads[slotHex] = toHex(db.getState(addr, slot))\\n }\\n } else {\\n this.countSlot(access.writes, slotHex)\\n }\\n }\\n\\n if (opcode === \\\"KECCAK256\\\") {\\n const ofs = parseInt(log.stack.peek(0).toString())\\n const len = parseInt(log.stack.peek(1).toString())\\n if (len > 20 && len < 512) {\\n this.keccak.push(toHex(log.memory.slice(ofs, ofs + len)))\\n }\\n } else if (opcode.startsWith(\\\"LOG\\\")) {\\n const count = parseInt(opcode.substring(3))\\n const ofs = parseInt(log.stack.peek(0).toString())\\n const len = parseInt(log.stack.peek(1).toString())\\n const topics = []\\n for (let i = 0; i < count; i++) {\\n topics.push(\\\"0x\\\" + log.stack.peek(2 + i).toString(16))\\n }\\n const data = toHex(log.memory.slice(ofs, ofs + len))\\n this.logs.push({\\n topics,\\n data\\n })\\n }\\n }\\n }\"}],\"id\":40720,\"jsonrpc\":\"2.0\"}",
"requestMethod": "POST",
"url": "https://frosty-solemn-diamond.matic.quiknode.pro/ae32fe5b91c1e127c4e6a065fe17d469910095c0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment