nostr:npub1drvpzev3syqt0kjrls50050uzf25gehpz9vgdw08hvex7e0vgfeq0eseet

I'm trying to use rust-nostr with Cloudflare Workers, but it exceeds the 1MiB limit.

Is there a way to reduce the size of the bundled rust-nostr?

(I'm new to Rust, so I'm sorry if this is a basic question.)

Total Upload: 2061.33 KiB / gzip: 1458.08 KiB

When I comment it out,

Total Upload: 459.45 KiB / gzip: 195.30 KiB

Here is the code.

https://github.com/SnowCait/cloudflare-sandbox/tree/fc86a201006e51745e00e24238d6c049a66f7f8d/rust-relay

Here is the Cloudflare Wokers document.

https://developers.cloudflare.com/workers/languages/rust/

Reply to this note

Please Login to reply.

Discussion

I opened a PR: https://github.com/SnowCait/cloudflare-sandbox/pull/1

I reduced a little bit the size. I'll investigate to understand what cause this size

Thank you!

I confirmed that the size has decreased.

Total Upload: 1621.89 KiB / gzip: 1332.35 KiB

I found the cause: it's the signature verification method.

Removing it the size (unzipped) is 642kb.

The verify signature method internally call only `secp.verify_schnorr` method (`secp256k1` library).

Indeed.

The size become much sumaller after removing the verify code.

Total Upload: 575.34 KiB / gzip: 299.15 KiB

I hope we can find an alternative as I don't want to save invalid data.