A very experimental PLC implementation which uses BFT consensus for decentralization

Apply safety limit on import ops against malicious proposers

gbl08ma.com f020ec86 7a8e3ec7

verified
+11 -3
+1
abciapp/import.go
··· 23 23 24 24 const EagerFetchMaxOps = 10000 25 25 const OpsPerImportTx = 1000 26 + const MaxOpsPerImportTx = 1000 26 27 const OpsPerEagerFetch = 1000 27 28 28 29 type authoritativeOperationsCache struct {
+10 -3
abciapp/tx_import.go
··· 125 125 }, nil 126 126 } 127 127 128 + if tx.Arguments.Count > MaxOpsPerImportTx { 129 + return &processResult{ 130 + Code: 4112, 131 + Info: "Unexpected import count", 132 + }, nil 133 + } 134 + 128 135 operations, err := aoc.get(ctx, expectedCursor, tx.Arguments.Count) 129 136 if err != nil { 130 137 return &processResult{ 131 - Code: 4112, 138 + Code: 4113, 132 139 Info: "Failure to obtain authoritative operations", 133 140 }, nil 134 141 } 135 142 136 143 if uint64(len(operations)) < tx.Arguments.Count { 137 144 return &processResult{ 138 - Code: 4113, 145 + Code: 4114, 139 146 Info: "Unexpected import count", 140 147 }, nil 141 148 } ··· 147 154 148 155 if hex.EncodeToString(expectedHashBytes) != tx.Arguments.Hash { 149 156 return &processResult{ 150 - Code: 4114, 157 + Code: 4115, 151 158 Info: "Unexpected import hash", 152 159 }, nil 153 160 }