Skip to content

Commit

Permalink
Fix minor issues in message marshalling and config files
Browse files Browse the repository at this point in the history
  • Loading branch information
pouya-eghbali committed Mar 25, 2024
1 parent 976d11a commit 2ef9644
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 26 deletions.
2 changes: 1 addition & 1 deletion conf.broker.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ rpc:
plugins:
uniswap:
schedule:
ethereum: 5000
ethereum: 5s

tokens:
- name: ethereum
Expand Down
2 changes: 1 addition & 1 deletion conf.remote.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ rpc:
plugins:
uniswap:
schedule:
ethereum: 5000
ethereum: 5s

tokens:
- name: ethereum
Expand Down
8 changes: 4 additions & 4 deletions conf.standalone.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ rpc:
plugins:
logs:
schedule:
arbitrum: 100
ethereum: 5000
arbitrum: 100ms
ethereum: 5s

events:
- name: DAI
Expand All @@ -39,8 +39,8 @@ plugins:

uniswap:
schedule:
arbitrum: 100
ethereum: 5000
arbitrum: 100ms
ethereum: 5s

tokens:
- name: ethereum
Expand Down
2 changes: 1 addition & 1 deletion conf.worker.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ rpc:
plugins:
uniswap:
schedule:
ethereum: 5000
ethereum: 5s

tokens:
- name: ethereum
Expand Down
2 changes: 1 addition & 1 deletion quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ rpc:
plugins:
uniswap:
schedule:
ethereum: 5000
ethereum: 5s

tokens:
- name: ethereum
Expand Down
22 changes: 8 additions & 14 deletions src/net/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,34 +334,25 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {

SendMessage(conn, messageType, opcodes.Feedback, "conf.ok")
Send(conn, messageType, opcodes.KoskChallenge, result)
case opcodes.PriceReport:
// TODO: Maybe this is unnecessary
if payload[1] != 0 {
SendError(conn, messageType, opcodes.Feedback, constants.ErrNotSupportedDataset)
continue
}

result, err := processPriceReport(conn, payload[2:])
case opcodes.PriceReport:
result, err := processPriceReport(conn, payload[1:])
if err != nil {
SendError(conn, messageType, opcodes.Error, err)
}

BroadcastPayload(opcodes.PriceReportBroadcast, result)
SendMessage(conn, messageType, opcodes.Feedback, "signature.accepted")
case opcodes.EventLog:
// TODO: Maybe this is unnecessary
if payload[1] != 0 {
SendError(conn, messageType, opcodes.Feedback, constants.ErrNotSupportedDataset)
continue
}

result, err := processEventLog(conn, payload[2:])
case opcodes.EventLog:
result, err := processEventLog(conn, payload[1:])
if err != nil {
SendError(conn, messageType, opcodes.Error, err)
}

BroadcastPayload(opcodes.EventLogBroadcast, result)
SendMessage(conn, messageType, opcodes.Feedback, "signature.accepted")

case opcodes.CorrectnessReport:
result, err := processCorrectnessRecord(conn, payload[1:])
if err != nil {
Expand All @@ -370,16 +361,19 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {

BroadcastPayload(opcodes.CorrectnessReportBroadcast, result)
SendMessage(conn, messageType, opcodes.Feedback, "signature.accepted")

case opcodes.KoskResult:
err := processKosk(conn, payload[1:])
if err != nil {
SendError(conn, messageType, opcodes.Error, err)
}
SendMessage(conn, messageType, opcodes.Feedback, "kosk.ok")

case opcodes.RegisterConsumer:
// TODO: Consumers must specify what they're subscribing to
repository.Consumers.Store(conn, true)
repository.BroadcastMutex.Store(conn, new(sync.Mutex))

default:
SendError(conn, messageType, opcodes.Error, constants.ErrNotSupportedInstruction)
}
Expand Down
2 changes: 1 addition & 1 deletion src/net/shared/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func SendRaw(data []byte) error {

func Send(opCode opcodes.OpCode, payload []byte) {
err := SendRaw(
append([]byte{byte(opCode), 0}, payload...),
append([]byte{byte(opCode)}, payload...),
)
if err != nil {
log.Logger.Error("Can't send packet: %v", err)
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/uniswap/uniswap.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,6 @@ func RecordSignature(
return true
})

reportLog.
With("Majority", fmt.Sprintf("%x", hash.Bytes())[:8]).
Debug("Values")
reportLog.
With("Majority", fmt.Sprintf("%x", hash.Bytes())[:8]).
Debug("Values")
Expand All @@ -225,6 +222,7 @@ func RecordSignature(
info.Asset,
SaveSignatureArgs{Hash: hash, Info: info},
)

if debounce {
DebouncedSaveSignatures(
info.Asset,
Expand Down

0 comments on commit 2ef9644

Please sign in to comment.