Skip to content

Commit 9c9a51c

Browse files
authored
Quicker Builds & Two Small Errors (#180)
1 parent be5f96a commit 9c9a51c

File tree

4 files changed

+8
-16
lines changed

4 files changed

+8
-16
lines changed

data-store/src/store.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl DataStore {
8181
.execute(conn);
8282
handle_insert_result(result, 1, format!("insert_metadata: {}", token));
8383

84-
// one of the following two tables will be updated (depending on token type.)
84+
// one of the following two tables should be updated (depending on token type.)
8585
let erc721_res = update(nfts::dsl::nfts)
8686
.set(nfts::metadata_id.eq::<Vec<u8>>((&*uid).into()))
8787
.filter(nfts::contract_address.eq(&token.db_address()))
@@ -92,10 +92,8 @@ impl DataStore {
9292
.filter(erc1155s::contract_address.eq(&token.db_address()))
9393
.filter(erc1155s::token_id.eq(&token.db_token_id()))
9494
.execute(conn);
95-
// Exactly one of the two tables should result in an update!
96-
assert_eq!(
97-
handle_query_result(erc721_res) + handle_query_result(erc1155_res),
98-
1,
95+
assert!(
96+
handle_query_result(erc721_res) + handle_query_result(erc1155_res) > 0,
9997
"invalid token update on metadata insertion {} - {:?}",
10098
token,
10199
uid

docker/Dockerfile.binary

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ WORKDIR /src/
44

55
# Copy & Build
66
COPY . .
7-
RUN cargo build --release
7+
RUN cargo build
88

99
# Extract Binary
1010
FROM docker.io/debian:bookworm-slim
1111

1212
RUN apt-get update && apt-get install -y ca-certificates tini libpq-dev
13-
COPY --from=builder /src/target/release/event-handler /usr/local/bin/event-handler
14-
COPY --from=builder /src/target/release/metadata-retriever /usr/local/bin/metadata-retriever
13+
COPY --from=builder /src/target/debug/event-handler /usr/local/bin/event-handler
14+
COPY --from=builder /src/target/debug/metadata-retriever /usr/local/bin/metadata-retriever
1515

1616
CMD echo "Specify binary..."
1717
ENTRYPOINT ["/usr/bin/tini", "--"]

metadata-retriever/src/routes/contract/abi.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,10 @@ impl EtherscanApi {
4646
fn handle_response(
4747
ApiResponse {
4848
status,
49-
message,
49+
message: _,
5050
result,
5151
}: ApiResponse<Value>,
5252
) -> Result<Option<Value>> {
53-
tracing::debug!(
54-
"Status {}, message: {:?}, result: {:?}",
55-
status,
56-
message,
57-
result
58-
);
5953
if status == "1" && result.is_some() {
6054
// The request was successful, return the result
6155
Ok(

metadata-retriever/src/routes/token/metadata/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl FetchedMetadata {
7676

7777
pub fn error(text: &str) -> Self {
7878
Self {
79-
hash: vec![0],
79+
hash: md5::compute(text.as_bytes()).0.to_vec(),
8080
raw: Some(text.into()),
8181
json: None,
8282
}

0 commit comments

Comments
 (0)